#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
#COPY ["nuget.config", "."]
COPY ["src/XfTech.SmartTms.HttpApi.Host/XfTech.SmartTms.HttpApi.Host.csproj", "src/XfTech.SmartTms.HttpApi.Host/"]
COPY ["src/XfTech.SmartTms.EntityFrameworkCore/XfTech.SmartTms.EntityFrameworkCore.csproj", "src/XfTech.SmartTms.EntityFrameworkCore/"]
COPY ["src/XfTech.SmartTms.Domain/XfTech.SmartTms.Domain.csproj", "src/XfTech.SmartTms.Domain/"]
COPY ["src/XfTech.SmartTms.Domain.Shared/XfTech.SmartTms.Domain.Shared.csproj", "src/XfTech.SmartTms.Domain.Shared/"]
COPY ["src/XfTech.SmartTms.Application/XfTech.SmartTms.Application.csproj", "src/XfTech.SmartTms.Application/"]
COPY ["src/XfTech.SmartTms.Application.Contracts/XfTech.SmartTms.Application.Contracts.csproj", "src/XfTech.SmartTms.Application.Contracts/"]
COPY ["src/XfTech.SmartTms.HttpApi/XfTech.SmartTms.HttpApi.csproj", "src/XfTech.SmartTms.HttpApi/"]
RUN dotnet restore "src/XfTech.SmartTms.HttpApi.Host/XfTech.SmartTms.HttpApi.Host.csproj"
COPY . .
WORKDIR "/src/src/XfTech.SmartTms.HttpApi.Host"
RUN dotnet build "XfTech.SmartTms.HttpApi.Host.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "XfTech.SmartTms.HttpApi.Host.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "XfTech.SmartTms.HttpApi.Host.dll"]